package org.qqcui.designpattern.patterns.facade;

/**
 * 门面类
 *
 * @author cuiqingqiang
 * @version 1.0
 * @date 2022/4/29 16:25
 **/
public class HomeTheaterFacade {

    private DVDPlayer dvdPlayer;
    private PopCorn popCorn;
    private Projector projector;
    private Screen screen;
    private Stereo stereo;
    private TheaterLight theaterLight;

    public HomeTheaterFacade() {
        super();
        dvdPlayer = DVDPlayer.getInstance();
        popCorn = PopCorn.getInstance();
        projector = Projector.getInstance();
        screen = Screen.getInstance();
        stereo = Stereo.getInstance();
        theaterLight = TheaterLight.getInstance();
    }

    public void ready() {
        // 打开爆米花机，爆米花
        popCorn.on();
        popCorn.pop();
        // 降下屏幕
        screen.down();
        // 打开投影仪
        projector.on();
        // 打开DVD播放器
        dvdPlayer.on();
        // 打开音效
        stereo.on();
        // 调暗灯光
        theaterLight.dim();
    }

    public void play() {
        // 开始播放DVD
        dvdPlayer.play();
    }

    public void pause() {
        // 暂停
        dvdPlayer.pause();
    }

    public void end() {
        // 停止爆米花机
        popCorn.off();
        // 停止播放DVD
        dvdPlayer.off();
        // 音效关闭
        stereo.off();
        // 投影仪关闭
        projector.off();
        // 屏幕上升
        screen.up();
        // 调亮灯光
        theaterLight.bright();
    }
}
